package com.dx.spring6_15.configBeanMethod;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author SDHT_31
 *	静态工厂方法：直接调用某一个类的静态方法就可以返回 Bean实例
 */
public class StaticCarFactory {
	
	private static Map<String,Car> cars = new HashMap<String,Car>();
	
	static {
		
		cars.put("audio", new Car("audio",11));
		cars.put("have", new Car("have",14));
	}
	
	public static Car getCar(String name){
		
		return cars.get(name);
	}
}
